let baseURL = '';
if (process.env.NODR_ENV === 'development') {
	// baseURL = "http://121.43.167.6:9111/zyj-api-web/"//本地地址
	baseURL = "https://www.microzuji.com/zyj-api-web/"//线上地址
} else {
	baseURL = "https://www.microzuji.com/zyj-api-web/"//线上地址
}

const request = (url, params = {}) => {
	return new Promise((resolve, reject) => {
		uni.showLoading({
			title: '加载中'
		})
		uni.request({
			url: baseURL + url,
			method: params.method || 'GET',
			data: params.data || '',
			header: {
				// 'content-type': 'application/x-www-form-urlencoded'
				'content-type':'application/json;charset=UTF-8'
			},
			success: (res) => {
				resolve(res)
			},
			fail: (err) =>{
				reject(err);
			},
			complete: () => {
				uni.hideLoading()
			}
		})
	})
}
export default request